<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <!-- 中央 政府  -->
  <script src="js/jquery-2.2.4.js"></script>
  <!--
    jquery :
      1. 选择器
      2. 动画
      3. ajax请求
      4. 操作css
      5. 操作style
  -->
  <title>Title</title>
</head>
<body>
<div>
  <input type="text" id="input"> 厘米
  <button id="btn">getRandomNumber</button>
  <button id="btn1">获取</button>
</div>
<script>
  let count = 0;
  $('#btn').click(function () {
    // count % 2 === 0 ? $('#input').hide(1000) : $('#input').show(1000);
    // count++;


  });

  let user = {
    data: [
      {name: '小张'},
      {name: '小李'},
      {name: '小王'},
      {name: '小胡'},
      {name: '小尤'},
    ],
    clickFn: function () {
      console.log(this);
      let random = Math.floor(Math.random() * 10 + 5);
      let randomIndex = Math.floor(Math.random() * this.data.length);

      $('#input').val(this.data[randomIndex]['name'] + '-----' + random);
    }
  };
  // this指向出错
  $('#btn1').click(user.clickFn.bind(user));



</script>
<script src="手动封装call和apply.js"></script>
</body>
</html>
